/**
 * 自定义组件 任意平行组件之间传参
 */
var Event = new Vue();

Vue.component("huahua",{
    template: `
        <div>
            我说：
            <input @keyup="onChange" v-model="i_said">
            <div>{{i_said}}</div>
        </div>  
    `, 
    data :function(){
        return {
            i_said : "你好，栓蛋"
        }
    },
    methods : {
        onChange : function(){
            Event.$emit("huahua-said",{said: this.i_said} )
        }
    }
})
Vue.component("shuandan", {
    template: `
        <div>
            花花说：
            <input v-model="huahua_said">
        </div>
    `,
    data : function(){
        return {
            huahua_said : null
        }
    }, 
    mounted : function (){
        var that = this;
        Event.$on("huahua-said", function(data){
            that.huahua_said = data.said
        })
    }
})


var app = new Vue({
    el : "#app"
})